package com.ms.game.slot.base;

import java.util.HashMap;

import com.xpec.c4.game.utility.GameUtility;

public class JPRandValueSys {
	private static HashMap<String, HashMap<String, GameJPRandRangeType>> container = new HashMap<String, HashMap<String, GameJPRandRangeType>>();

	static {
	}

	/**
	 * 讀取rand type
	 * 
	 * @param game
	 * @param typeName
	 * @return
	 */
	public static GameJPRandRangeType getType(String game, String typeName) {
		if (!container.containsKey(game)) {
			return null;
		}

		HashMap<String, GameJPRandRangeType> data = container.get(game);

		if (!data.containsKey(typeName)) {
			return null;
		}

		return data.get(typeName);
	}

	/**
	 * 隨機讀取jp數值
	 * 
	 * @param type
	 * @return
	 */
	public static int getJPRandValue(GameJPRandRangeType type) {
		return GameUtility.randomInt(type.getMin(), type.getMax());
	}

	/**
	 * 是否需要新的隨機值
	 * 
	 * @param value
	 * @return
	 */
	public static boolean IsNeedRandValue(int value) {
		return (value == 0) ? true : false;
	}
}
